package com.mjx.algorithm.oj;

import java.util.Scanner;

/**
 * 线段是否与矩形相交
 * Created by 梅京翔 on 2017 02 08下午 8:57.
 */
public class problem1052 {
    static class Point{
        public Integer x;
        public Integer y;

        public Point(Integer x, Integer y) {
            this.x = x;
            this.y = y;
        }
    }
    
    //叉积
    public static double mult(Point a, Point b, Point c)
    {
        return (a.x-c.x)*(b.y-c.y)-(b.x-c.x)*(a.y-c.y);
    }

    public static boolean intersect(Point aa, Point bb, Point cc, Point dd)
    {
        if ( Math.max(aa.x, bb.x)<Math.min(cc.x, dd.x) )
        {
            return false;
        }
        if ( Math.max(aa.y, bb.y)<Math.min(cc.y, dd.y) )
        {
            return false;
        }
        if ( Math.max(cc.x, dd.x)<Math.min(aa.x, bb.x) )
        {
            return false;
        }
        if ( Math.max(cc.y, dd.y)<Math.min(aa.y, bb.y) )
        {
            return false;
        }
        if ( mult(cc, bb, aa)*mult(bb, dd, aa)<0 )
        {
            return false;
        }
        if ( mult(aa, dd, cc)*mult(dd, bb, cc)<0 )
        {
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        Scanner scanner =new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();//读回车
        for (int i = 0; i < n; i++) {
            String s = scanner.nextLine();
            String[] numbers =  s.split(" ");
            int[] num = new int[numbers.length];
            for (int j = 0; j < numbers.length; j++) {
                num[j] = Integer.parseInt(numbers[j]);
            }
            Point a = new Point(num[0],num[1]);
            Point b = new Point(num[2],num[3]);
            Point c = new Point(Math.min(num[4],num[6]),Math.min(num[5],num[7]));
            Point d = new Point(Math.min(num[4],num[6]),Math.max(num[5],num[7]));
            Point e = new Point(Math.max(num[4],num[6]),Math.max(num[5],num[7]));
            Point f = new Point(Math.max(num[4],num[6]),Math.max(num[5],num[7]));
            boolean r1 = intersect(a,b,c,d);
            boolean r2 = intersect(a,b,c,f);
            boolean r3 = intersect(a,b,e,d);
            boolean r4 = intersect(a,b,e,f);
            if (r1 || r2 || r3 || r4)
                System.out.println("T");
            else
                System.out.println("F");
        }
    }
}
